import java.util.Arrays;
import java.util.Random;

public class Test {
    public static void orderArray(int[] array) {
        for (int i = 0; i < array.length; i++) {
            //array[i] = i;
            array[i] = array.length - 1 - i;
        }
    }

    public static void notOrderArray(int[] array) {
        Random random = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = random.nextInt(10_0000);
        }
    }

    public static void testMergeSort(int[] array) {
        long startTime = System.currentTimeMillis();
        Sort.mergeSort(array);
        long endTime = System.currentTimeMillis();
        System.out.println("归并排序耗时:" + (endTime - startTime));
    }

    public static void main(String[] args) {
        //testSimple();
        testOther();
    }

    public static void testSimple() {
        int[] array = {12,5,2,9,10,7};
        System.out.println("排序前：" + Arrays.toString(array));
        Sort.mergeSort(array);
        System.out.println("排序后：" + Arrays.toString(array));
    }

    public static void testOther() {
        int[] array = new int[10_0000];
        //orderArray(array);
        notOrderArray(array);
        testMergeSort(array);
    }
}
